/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} l1
 * @param {ListNode} l2
 * @return {ListNode}
 */
var mergeTwoLists = function (l1, l2) {
    const dummyHead = new ListNode(0)
    let move = dummyHead
    while (l1 && l2) {
        if (l1.val < l2.val) {
            move.next = l1
            l1 = l1.next
        } else {
            move.next = l2
            l2 = l2.next
        }
        move = move.next
    }
    move.next = l1 ? l1 : l2
    return dummyHead.next
};